﻿@model IEnumerable<Parichay.Domain.MemberUploads>

@{
    ViewBag.Title = "My Uploaded Files";
}

@section Styles {
    <link href="@Url.Content("~/Content/styles/jquery.ui.css")" rel="stylesheet" type="text/css" />
}
<script src="@Url.Content("~/Content/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('a.page-help').click(function () {
            var $link = $(this);
            var vurl = $link.attr('href');
            //var $data = '<div><img src="' + url + '" alt="" /></div>';
            $.ajax({
                url: vurl,
                success: function (data) {
                    $("#previewDiv").html('<img src="' + data + '" alt="" />').dialog({ modal: true });
                },
                error: function (err) {
                    alert(err);
                }
            });
            return false;
        });

    });
</script>
<fieldset>
<legend><h2>My Uploads</h2></legend>
<table class="tblAllBorders">
    <tr>
    <th>
            File Name
        </th>
        <th>
            Size
        </th>
        <th>Details</th>
        <th>
            Create Date
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Attachmt)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FileSize)
        </td>
        <td>
            @Html.ActionLink("Details", "Avatar", new { id = item.Id }, new { onclick = "window.open(this.href, 'popupwindow', 'width=500,height=500'); return false;" })
        </td>
        
        <td>
            @Html.DisplayFor(modelItem => item.CreateD)
        </td>
        <td>
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })
        </td>
    </tr>
}

</table>
</fieldset>
<br />
<div id="previewDiv"></div>

<div id="avtar-dialog" style="display:none" title="Upload files">        
    @using (Html.BeginForm("AddFile", "Media", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {<br />
        <p><input type="file" id="fileUpload" name="fileUpload" size="23"/></p><br />
        <p><input type="submit" value="Upload file" /></p>        
     } 
</div>
<a href="#" onclick="$('#avtar-dialog').css({display:'block'}).dialog({modal:true}); return false">Upload Another</a>